var app = getApp()

Page({

  /**
   * 页面的初始数据
   */
  data: {
    name: '海苔宝贝',
    positon: "首席传播大使",
    phone: "13258789898",
    headImg: ''
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this
    wx.getStorage({
      key: 'openid',
      success: function (res) {
        let openid = res.data

        wx.request({
          url: app.globalData.URL + '/app/personal/shangji?openid=' + openid,
          success: function (res) {
            console.log(res.data)

            that.setData({
              name: res.data.tuijian.realName,
              positon: res.data.tuijian.beInvitedLevel,
              headImg: res.data.tuijian.headImgUrl,
              phone: res.data.tuijian.telPhone
            })

          }
        })
      },
    })
  },

  makePhone: function () {
    wx.makePhoneCall({
      phoneNumber: this.data.phone,
      success: function (res) { },
      fail: function (res) { },
      complete: function (res) { },
    })
  }

})